package leetcode_题库;

import java.util.Arrays;

/**
 * Created by IntelliJ IDEA.
 *
 * @Author : Ding
 * @create 2022/8/19 10:25
 */
public class _344_反转字符串 {
    public static void main(String[] args) {
        char[] chars = new char[]{'h','e','l','l','o'};

        int lp = 0;
        int rp = chars.length - 1;

        while (lp < rp){
            chars[lp] ^= chars[rp];
            chars[rp] ^= chars[lp];
            chars[lp] ^= chars[rp];
            lp ++;
            rp --;
        }

        System.err.println(Arrays.toString(chars));

        /*

            > 2022/08/19 10:36:20
            解答成功:
                执行耗时:0 ms,击败了100.00% 的Java用户
                内存消耗:48.2 MB,击败了46.54% 的Java用户

         */
    }
}
